<?php
/**
 * shopify日志
 * (shopify-model)
 */
namespace App\Models\Shopify;


use Illuminate\Database\Eloquent\Model;

class ShopifyLogs extends Model {

    protected $connection = 'mysql_shopify';

    protected $table = 'shopify_logs';

    protected $guarded  = [];

    public static $logOrderSync = 'order_sync';
    public static $customerOrderSync = 'customer_order_sync';
    public static $customerOrderException = 'customer_order_exception';

    /**
     * 添加日志
     * @param $type
     * @param $content
     * @param array $logData
     * @return \Illuminate\Database\Eloquent\Builder|Model
     */
    public static function logs($type, $content, $logData = []){
        return self::query()->create([
            'type' => $type,
            'content' => $content,
            'data' => json_encode($logData)
        ]);
    }

}
